import React from "react";
import { Route } from "react-router-dom";
import Home from "./router/Home";
import FocusNews from "./router/FocusNews";
import HotNews from "./router/HotNews";
import Forum from "./router/Forum";
import ThinkTank from "./router/ThinkTank";
import ThinkTankData from "./router/ThinkTankData";
import Decision from "./router/Decision";
import Org from "./router/Org";
import OrgEva from "./router/OrgEva/OrgEva";

import Main from "./router/Company/Main";
import Info from "./router/Company/Info";
import Project from "./router/Company/Project/index";
import Result from "./router/Company/Result/index";
import Publish from "./router/Company/Publish/index";
import OrgAbout from "./router/Company/OrgAbout/index";

import ThemeAd from "./router/ThemeAd";
import themeAdType from "./router/ThemeAdType";
import HomeHeader from "./router/HomeHeader/HomeHeader";
import HomeDetail from "./router/HomeHeader/HomeDetail";
import Title from "./components/Company/Main/Title";

export const compantyRoutes = [
  {
    path: "/org/main",
    title: "单位首页",
    exact: true,
    component: Main
  },
  {
    path: "/org/info",
    title: "单位简介",
    exact: true,
    component: OrgAbout
  },
  {
    path: "/org/project",
    title: "研究项目",
    exact: true,
    component: Project
  },
  {
    path: "/org/result",
    title: "研究成果",
    exact: true,
    component: Result
  },
  {
    path: "/org/publish",
    title: "出版物",
    exact: true,
    component: Publish
  }
];

export const routes = [
  {
    path: "/mainPage/main",
    title: "首页",
    component: Home,
    routes: [
      {
        path: "/mainPage/main/headerList",
        component: HomeHeader
      }
    ]
  },
  {
    path: "/mainPage/focusNews",
    title: "要闻动态",
    component: FocusNews
  },
  {
    path: "/mainPage/hotNews",
    title: "热点资讯",
    component: HotNews
  },
  {
    path: "/mainPage/forum",
    title: "会议论坛",
    component: Forum
  },
  {
    path: "/mainPage/decision",
    title: "决策调研",
    component: Decision,
    exact: true
  },
  {
    path: "/mainPage/thinkTank",
    title: "专业智库",
    component: ThinkTank
  },
  {
    path: "/mainPage/thinkTankData",
    title: "智库数据",
    component: ThinkTankData
  },
  {
    path: "/mainPage/org",
    title: "智库联盟",
    component: Org
  },
  {
    path: "/mainPage/evaluation",
    title: "智库评价",
    component: OrgEva
  },
  {
    path: "/mainPage/ThemeAd/:id",
    Title: "专题广告",
    component: ThemeAd
  },
  {
    path: "/mainPage/themeAdType/:id",
    Title: "专题广告列表",
    component: themeAdType
  }
];

export function RouteWithSubRoutes(route) {
  return (
    <Route
      path={route.path}
      exact={route.exact}
      render={props => <route.component {...props} routes={route.routes} />}
    />
  );
}
